<?php

namespace app\admin\validate\general;

use think\Validate;

class Staff extends Validate
{
    /**
     * 验证规则
     */
    protected $rule = [
        'name' => 'require|unique:staff',
        'mobile' => 'require|regex:/^1[3-9]\d{9}$/|unique:staff',
        'invite' => 'require|unique:staff',
    ];
    /**
     * 提示消息
     */
    protected $message = [
        'name.require' => '请填写姓名',
        'name.unique' => '该姓名已添加',
        'mobile.require' => '请填写手机号',
        'mobile.regex' => '请填写正确的手机号',
        'mobile.unique' => '改手机号已添加',
        'invite.require' => '请填写推广码',
        'invite.unique' => '该推广码已添加',
    ];
    /**
     * 验证场景
     */
    protected $scene = [
        'add'  => ['name','mobile','invite'],
        'edit' => ['name','mobile','invite'],
    ];
    
}
